Skip to content

Conversation

francinelucca
Copy link
Member

@francinelucca francinelucca commented Sep 9, 2025

This pull request introduces a new PortalContext to the @primer/react library, allowing more flexible and context-driven control over where portal content is rendered. The changes include updates to the core Portal component, its exports, new Storybook examples, and additional tests to ensure correct behavior when using PortalContext and container overrides.

Changelog

New

  • Added PortalContext to Portal.tsx, allowing consumers to specify a portalContainerName via React context, which determines the portal root container for content rendering. The Portal component now prioritizes the context value unless overridden by its own containerName prop.
  • Added new tests in Portal.test.tsx to verify correct portal rendering behavior when using PortalContext, including context-only, default fallback, undefined context, and prop override scenarios.
  • Added a Storybook example (WithPortalContext) in Portal.features.stories.tsx to demonstrate how to use PortalContext for controlling portal rendering, including context and prop override cases.

Changed

  • Updated exports in index.ts and the package entry point to include PortalContext, making it available for consumers.

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Copy link

changeset-bot bot commented Sep 9, 2025

🦋 Changeset detected

Latest commit: 1884fcc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@primer/react Minor
@primer/styled-react Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 9, 2025
Copy link
Contributor

github-actions bot commented Sep 9, 2025

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@francinelucca
Copy link
Member Author

@copilot add tests to ensure elements render correctly inside custom Portal when PortalContext is supplied and on the default otherwise

Copy link
Contributor

Copilot AI commented Sep 9, 2025

@francinelucca I've opened a new pull request, #6816, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

github-actions bot commented Sep 9, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 89.62 KB (+0.11% 🔺)
packages/react/dist/browser.umd.js 89.56 KB (-0.06% 🔽)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: francinelucca <[email protected]>
@francinelucca
Copy link
Member Author

@copilot add a storybook story that demonstrates how to use PortalContext to render items within a different Portal than the default

Copy link
Contributor

Copilot AI commented Sep 9, 2025

@francinelucca I've opened a new pull request, #6821, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actions github-actions bot requested a deployment to storybook-preview-6815 September 9, 2025 23:29 Abandoned
@francinelucca francinelucca marked this pull request as ready for review September 10, 2025 14:18
@Copilot Copilot AI review requested due to automatic review settings September 10, 2025 14:18
@francinelucca francinelucca requested a review from a team as a code owner September 10, 2025 14:18
@github-actions github-actions bot requested a deployment to storybook-preview-6815 September 10, 2025 14:19 Abandoned
Copilot

This comment was marked as outdated.

Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@github-actions github-actions bot added integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 11, 2025
Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@francinelucca
Copy link
Member Author

@copilot fix the accessibility issue with the dark theme by using token background colors from the theme

Copy link
Contributor

Copilot AI commented Sep 12, 2025

@francinelucca I've opened a new pull request, #6847, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actions github-actions bot removed the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 12, 2025
Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 12, 2025
Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@github-actions github-actions bot requested a deployment to storybook-preview-6815 September 12, 2025 18:26 Abandoned
@francinelucca francinelucca added this pull request to the merge queue Sep 12, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 12, 2025
@francinelucca francinelucca added this pull request to the merge queue Sep 12, 2025
Merged via the queue into main with commit 2024709 Sep 12, 2025
43 checks passed
@francinelucca francinelucca deleted the chore/add-portal-context branch September 12, 2025 21:58
@primer primer bot mentioned this pull request Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants